const { WebSocketServer } = require('ws');
const { createServer } = require('http');
const queryString = require('query-string');

const server = createServer();

const wss = new WebSocketServer({server});



wss.on('connection', function connection(ws, req) {
    const query = queryString.parse(req.url.slice(1));
    
    ws.on('message', async function (message) {
        console.log(message.toString('utf-8'))
        ws.send('hello haha')
    });

    ws.on('close', function() {
        
    })
});

server.listen(10024)
